/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package homomorphism;

import org.apache.hadoop.io.LongWritable;
import org.apache.hadoop.io.Writable;
import org.apache.hadoop.mapred.JobConf;
import org.apache.hadoop.mapred.Partitioner;
import utility.LongPair;

/**
 *
 * @author takeshi
 */
    public  class ListPartitioner
            implements Partitioner<LongPair,   Writable  > {

        @Override
        public void configure(JobConf job) {
        }

        @Override
        public int getPartition(LongPair key,  Writable  value, int numPartitions) {
        //     return key.hashCode() % numPartitions;
          return  (int) ( key.getFirst() * 127) % numPartitions;
      //      return  (int) ( key.getFirst());
        }
        
        private int partitionByIndex(){
            
            return -1;
        }
    }